package com.GGG.cloud.house.web;

import com.GGG.cloud.house.domain.entity.News;
import com.GGG.cloud.house.domain.entity.NewsTag;
import com.GGG.cloud.house.domain.entity.User;
import com.GGG.cloud.house.domain.vo.NewsVo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.List;

/**
 * Description：
 *
 * @author lx
 * @date 2020/10/2 20:52
 */
@Controller
public class NewsController {

    @RequestMapping("news.html")
    public String showHouseNews(ModelMap modelMap){
        modelMap.put("title","房产新闻");
        List<User> userList = new ArrayList<>();
        userList.add(new User("唐纳德"));
        userList.add(new User("特兰普"));
        userList.add(new User("川普"));
        userList.add(new User("郭德纲"));
        userList.add(new User("希洛克"));
        userList.add(new User("伊西斯"));

        List<News> newsList = new ArrayList<>();
        newsList.add(new News("惊雷"));
        newsList.add(new News("紫电"));
        newsList.add(new News("乌云"));
        newsList.add(new News("奥力给"));
        newsList.add(new News("大大泡泡糖"));
        newsList.add(new News("旺仔牛奶"));

        List<NewsTag> newsTagList = new ArrayList<>();
        newsTagList.add(new NewsTag("这通天修为天塌地陷紫金锤"));
        newsTagList.add(new NewsTag("说玄真火焰九天玄剑惊天变"));
        newsTagList.add(new NewsTag("驰骋沙场呼啸烟雨顿"));
        newsTagList.add(new NewsTag("奥力给"));
        newsTagList.add(new NewsTag("大大泡泡糖"));
        newsTagList.add(new NewsTag("旺仔牛奶"));

        List<NewsVo> newsVoList = new ArrayList<>();
        newsVoList.add(new NewsVo(userList.get(0).getName(),newsList.get(0).getTitle(),newsTagList.get(0).getDescription()));
        newsVoList.add(new NewsVo(userList.get(1).getName(),newsList.get(1).getTitle(),newsTagList.get(1).getDescription()));
        newsVoList.add(new NewsVo(userList.get(2).getName(),newsList.get(2).getTitle(),newsTagList.get(2).getDescription()));
        newsVoList.add(new NewsVo(userList.get(3).getName(),newsList.get(3).getTitle(),newsTagList.get(3).getDescription()));
        newsVoList.add(new NewsVo(userList.get(4).getName(),newsList.get(4).getTitle(),newsTagList.get(4).getDescription()));
        newsVoList.add(new NewsVo(userList.get(5).getName(),newsList.get(5).getTitle(),newsTagList.get(5).getDescription()));

        modelMap.put("newsVoList",newsVoList);

        return "news";
    }
}
